
#include "SysConfig.h"
#include "Define.h"
#include "Port.h"
#include "Display.h"

unsigned char ucPT6524_Send_Ongoing;
unsigned char ucPT6524_Active;
unsigned char ucPT6524_Buf[35];
unsigned char ucPT6524_CE;
unsigned char ucPT6524_Update_5msecTimer;
unsigned char ucPT6524_Cnt;
#if  0
union{
	struct{
	//////// COM0 - Buf0 ///////////		
		unsigned char S_2K:1;
		unsigned char S_2E:1;
		unsigned char S_2F:1;
		unsigned char S_2G:1;
		unsigned char S_2N:1;
		unsigned char S_2J:1;
		unsigned char S_2H:1;
		unsigned char S_2A:1;
	//////// COM0 - Buf1 ///////////		
		unsigned char S_2L:1;
		unsigned char S_2C:1;
		unsigned char S_2B:1;
		unsigned char S_2I:1;
		unsigned char S_X8:1;
		unsigned char S_X7:1;
		unsigned char S_X6:1;
		unsigned char S_X5:1;
	//////// COM0 - Buf2 ///////////	
		unsigned char S_X:1;
		unsigned char S_X1:1;
		unsigned char S_X2:1;
		unsigned char S_X3:1;
		unsigned char S_X4:1;
		unsigned char S_None1:1;
		unsigned char S_None2:1;
		unsigned char S_None3:1;
	//////// COM0 - Buf3 ///////////		
		unsigned char S_3K:1;
		unsigned char S_3E:1;
		unsigned char S_3F:1;
		unsigned char S_3G:1;
		unsigned char S_3N:1;
		unsigned char S_3J:1;
		unsigned char S_3H:1;
		unsigned char S_3A:1;
	//////// COM0 - Buf4 ///////////	
		unsigned char S_3L:1;
		unsigned char S_3C:1;
		unsigned char S_3B:1;
		unsigned char S_3I:1;
		unsigned char S_4K:1;
		unsigned char S_4E:1;
		unsigned char S_4F:1;
		unsigned char S_4G:1;
	//////// COM0 - Buf5 ///////////	
		unsigned char S_4N:1;
		unsigned char S_4J:1;
		unsigned char S_4H:1;
		unsigned char S_4A:1;
		unsigned char S_4L:1;
		unsigned char S_4C:1;
		unsigned char S_4B:1;
		unsigned char S_4I:1;
	//////// COM0 - Buf6 ///////////	
		unsigned char S_BT:1;
		unsigned char S_5K:1;
		unsigned char S_5E:1;
		unsigned char S_5F:1;
		unsigned char S_Dummy0:2;
		unsigned char S_CU:1;
		unsigned char S_P0:1;
	//////// COM0 - Buf7 ///////////	
		unsigned char S_P1:1;
		unsigned char S_P2:1;
		unsigned char S_P3:1;
		unsigned char S_DR:1;
		unsigned char S_SC:1;
		unsigned char S_BU:1;
		unsigned char S_DT0:2;
	//////// COM1 - Buf0 ///////////		
		unsigned char S_5D:1;
		unsigned char S_5N:1;
		unsigned char S_5J:1;
		unsigned char S_5G:1;
		unsigned char S_USB:1;
		unsigned char S_5L:1;
		unsigned char S_5H:1;
		unsigned char S_5A:1;		
	//////// COM1 - Buf1 ///////////	
		unsigned char S_None4:1;
		unsigned char S_5C:1;
		unsigned char S_5B:1;
		unsigned char S_5I:1;
		unsigned char S_AUX:1;
		unsigned char S_6K:1;
		unsigned char S_6E:1;
		unsigned char S_6F:1;
	//////// COM1 - Buf2 ///////////		
		unsigned char S_6D:1;
		unsigned char S_6N:1;
		unsigned char S_6J:1;
		unsigned char S_6G:1;
		unsigned char S_None5:1;
		unsigned char S_6L:1;
		unsigned char S_6H:1;
		unsigned char S_6A:1;
	//////// COM1 - Buf3 ///////////		
		unsigned char S_MP3:1;
		unsigned char S_6C:1;
		unsigned char S_6B:1;
		unsigned char S_6I:1;
		unsigned char S_None6:1;
		unsigned char S_7K:1;	
		unsigned char S_7E:1;
		unsigned char S_7F:1;
	//////// COM1 - Buf4 ///////////		
		unsigned char S_7D:1;
		unsigned char S_7N:1;
		unsigned char S_7J:1;
		unsigned char S_7G:1;
		unsigned char S_4D:1;
		unsigned char S_7L:1;
		unsigned char S_7H:1;
		unsigned char S_7A:1;
	//////// COM1 - Buf5 ///////////		
		unsigned char S_3D:1;
		unsigned char S_7C:1;
		unsigned char S_7B:1;
		unsigned char S_7I:1;
		unsigned char S_WMA:1;
		unsigned char S_8K:1;
		unsigned char S_8E:1;
		unsigned char S_8F:1;
	//////// COM1 - Buf6 ///////////
		unsigned char S_8D:1;
		unsigned char S_8N:1;
		unsigned char S_8J:1;
		unsigned char S_8G:1;
		unsigned char S_Dummy1:4;
	//////// COM1 - Buf7 ///////////	
		unsigned char S_Dummy2:6;
		unsigned char S_DT1:2;		
	//////// COM2 - Buf0 ///////////	
		unsigned char S_2D:1;
		unsigned char S_8L:1;
		unsigned char S_8H:1;
		unsigned char S_8A:1;
		unsigned char S_ST:1;
		unsigned char S_8C:1;
		unsigned char S_8B:1;
		unsigned char S_8I:1;
	//////// COM2 - Buf1 ///////////
		unsigned char S_FD:1;
		unsigned char S_9K:1;
		unsigned char S_9E:1;
		unsigned char S_9F:1;
		unsigned char S_9D:1;
		unsigned char S_9N:1;
		unsigned char S_9J:1;
		unsigned char S_9G:1;
	//////// COM2 - Buf2 ///////////
		unsigned char S_None7:1;
		unsigned char S_9L:1;
		unsigned char S_9H:1;
		unsigned char S_9A:1;
		unsigned char S_COL:1;
		unsigned char S_9C:1;
		unsigned char S_9B:1;
		unsigned char S_9I:1;
	//////// COM2 - Buf3 ///////////
		unsigned char S_None8:1;
		unsigned char S_10K:1;		
		unsigned char S_10E:1;		
		unsigned char S_10F:1;
		unsigned char S_10D:1;
		unsigned char S_10N:1;
		unsigned char S_10J:1;
		unsigned char S_10G:1;
	//////// COM2 - Buf4 ///////////	
		unsigned char S_INT:1;
		unsigned char S_10L:1;
		unsigned char S_10H:1;
		unsigned char S_10A:1;
		unsigned char S_RPT:1;
		unsigned char S_10C:1;
		unsigned char S_10B:1;
		unsigned char S_10I:1;
	//////// COM2 - Buf5 ///////////
		unsigned char S_None9:1;
		unsigned char S_11K:1;
		unsigned char S_11E:1;
		unsigned char S_11F:1;
		unsigned char S_11D:1;
		unsigned char S_11N:1;
		unsigned char S_11J:1;
		unsigned char S_11G:1;
	//////// COM2 - Buf6 ///////////	
		unsigned char S_RDM:1;
		unsigned char S_11L:1;
		unsigned char S_11H:1;
		unsigned char S_11A:1;
		unsigned char S_Dummy3:4;
	//////// COM2 - Buf7 ///////////
		unsigned char S_Dummy4:6;	
		unsigned char S_DT2:2;
	//////// COM3 - Buf0 ///////////	
		unsigned char S_P:1;
		unsigned char S_11C:1;
		unsigned char S_11B:1;
		unsigned char S_11I:1;
		unsigned char S_None10:1;
		unsigned char S_12K:1;
		unsigned char S_12E:1;
		unsigned char S_12F:1;
	//////// COM3 - Buf1 ///////////	
		unsigned char S_12D:1;
		unsigned char S_12N:1;
		unsigned char S_12J:1;
		unsigned char S_12G:1;
		unsigned char S_LOUD:1;
		unsigned char S_12L:1;
		unsigned char S_12H:1;
		unsigned char S_12A:1;
	//////// COM3 - Buf2 ///////////
		unsigned char S_None11:1;
		unsigned char S_12C:1;
		unsigned char S_12B:1;
		unsigned char S_12I:1;
		unsigned char S_None12:1;
		unsigned char S_13K:1;
		unsigned char S_13E:1;
		unsigned char S_13F:1;
	//////// COM3 - Buf3 ///////////	
		unsigned char S_13D:1;
		unsigned char S_13N:1;
		unsigned char S_13J:1;
		unsigned char S_13G:1;
		unsigned char S_EQ:1;
		unsigned char S_13L:1;
		unsigned char S_13H:1;
		unsigned char S_13A:1;
	//////// COM3 - Buf4 ///////////		
		unsigned char S_None13:1;
		unsigned char S_13C:1;
		unsigned char S_13B:1;
		unsigned char S_13I:1;
		unsigned char S_None14:1;
		unsigned char S_None15:1;
		unsigned char S_None16:1;
		unsigned char S_COM4:1;
	//////// COM3 - Buf5 ///////////		
		unsigned char S_None17:1;
		unsigned char S_None18:1;
		unsigned char S_COM3:1;
		unsigned char S_None19:1;
		unsigned char S_None20:1;
		unsigned char S_COM2:1;
		unsigned char S_None21:1;
		unsigned char S_None22:1;
	//////// COM3 - Buf6 ///////////		
		unsigned char S_COM1:1;
		unsigned char S_None23:1;
		unsigned char S_None24:1;
		unsigned char S_None25:1;
		unsigned char S_Dummy5:4;
	//////// COM3 - Buf7 ///////////		
		unsigned char S_Dummy6:6;	
		unsigned char S_DT3:2;
	}bit;
	struct{
		unsigned char ucBuf[PT6524_DATA_SIZE];
	}Byte;
	struct{
		unsigned char ucCom0[PT6524_DATA_SIZE/4];
		unsigned char ucCom1[PT6524_DATA_SIZE/4];
		unsigned char ucCom2[PT6524_DATA_SIZE/4];
		unsigned char ucCom3[PT6524_DATA_SIZE/4];
	}ComData;
}PT6524_Bit;


#else

union{
	struct{
	//////// COM0 - Buf0 ///////////	
		unsigned char S_2N:1;
		unsigned char S_2J:1;
		unsigned char S_2H:1;
		unsigned char S_2A:1;
		unsigned char S_2K:1;
		unsigned char S_2E:1;
		unsigned char S_2F:1;
		unsigned char S_2G:1;

	//////// COM0 - Buf1 ///////////			
		unsigned char S_X8:1;
		unsigned char S_X7:1;
		unsigned char S_X6:1;
		unsigned char S_X5:1;
		unsigned char S_2L:1;
		unsigned char S_2C:1;
		unsigned char S_2B:1;
		unsigned char S_2I:1;

	//////// COM0 - Buf2 ///////////		
		unsigned char S_X4:1;
		unsigned char S_NONE0:3;
		unsigned char S_X:1;
		unsigned char S_X1:1;
		unsigned char S_X2:1;
		unsigned char S_X3:1;
	//////// COM0 - Buf3 ///////////		
		unsigned char S_3N:1;
		unsigned char S_3J:1;
		unsigned char S_3H:1;
		unsigned char S_3A:1;
		unsigned char S_3K:1;
		unsigned char S_3E:1;
		unsigned char S_3F:1;
		unsigned char S_3G:1;
	//////// COM0 - Buf4 ///////////		
		unsigned char S_4K:1;
		unsigned char S_4E:1;
		unsigned char S_4F:1;
		unsigned char S_4G:1;
		unsigned char S_3L:1;
		unsigned char S_3C:1;
		unsigned char S_3B:1;
		unsigned char S_3I:1;
	//////// COM0 - Buf5 ///////////		
		unsigned char S_4L:1;
		unsigned char S_4C:1;
		unsigned char S_4B:1;
		unsigned char S_4I:1;
		unsigned char S_4N:1;
		unsigned char S_4J:1;
		unsigned char S_4H:1;
		unsigned char S_4A:1;
	//////// COM0 - Buf6 ///////////	
		unsigned char S_NONE1:2;
		unsigned char S_CU:1;
		unsigned char S_P0:1;	
		unsigned char S_BT:1;
		unsigned char S_5K:1;
		unsigned char S_5E:1;
		unsigned char S_5F:1;
	//////// COM0 - Buf7 ///////////		
		unsigned char S_DT0:2;
		unsigned char S_BU:1;
		unsigned char S_SC:1;
		unsigned char S_DR:1;
		unsigned char S_P3:1;
		unsigned char S_P2:1;
		unsigned char S_P1:1;
	//////// COM1 - Buf0 ///////////		
		unsigned char S_USB:1;
		unsigned char S_5L:1;
		unsigned char S_5H:1;
		unsigned char S_5A:1;	
		unsigned char S_5D:1;
		unsigned char S_5N:1;
		unsigned char S_5J:1;
		unsigned char S_5G:1;		
	//////// COM1 - Buf1 ///////////	
		unsigned char S_AUX:1;
		unsigned char S_6K:1;
		unsigned char S_6E:1;
		unsigned char S_6F:1;
		unsigned char S_NONE2:1;
		unsigned char S_5C:1;
		unsigned char S_5B:1;
		unsigned char S_5I:1;
	//////// COM1 - Buf2 ///////////		
		unsigned char S_NONE3:1;
		unsigned char S_6L:1;
		unsigned char S_6H:1;
		unsigned char S_6A:1;
		unsigned char S_6D:1;
		unsigned char S_6N:1;
		unsigned char S_6J:1;
		unsigned char S_6G:1;
	//////// COM1 - Buf3 ///////////		
		unsigned char S_NONE4:1;
		unsigned char S_7K:1;
		unsigned char S_7E:1;
		unsigned char S_7F:1;
		unsigned char S_MP3:1;
		unsigned char S_6C:1;
		unsigned char S_6B:1;
		unsigned char S_6I:1;
	//////// COM1 - Buf4 ///////////		
		unsigned char S_4D:1;
		unsigned char S_7L:1;
		unsigned char S_7H:1;
		unsigned char S_7A:1;
		unsigned char S_7D:1;
		unsigned char S_7N:1;
		unsigned char S_7J:1;
		unsigned char S_7G:1;
	//////// COM1 - Buf5 ///////////		
		unsigned char S_WMA:1;
		unsigned char S_8K:1;
		unsigned char S_8E:1;
		unsigned char S_8F:1;
		unsigned char S_3D:1;
		unsigned char S_7C:1;
		unsigned char S_7B:1;
		unsigned char S_7I:1;
	//////// COM1 - Buf6 ///////////
		unsigned char S_NONE5:4;
		unsigned char S_8D:1;
		unsigned char S_8N:1;
		unsigned char S_8J:1;
		unsigned char S_8G:1;
	//////// COM1 - Buf7 ///////////	
		unsigned char S_DT1:2;
		unsigned char S_Dummy2:6;
	//////// COM2 - Buf0 ///////////		
		unsigned char S_ST:1;
		unsigned char S_8C:1;
		unsigned char S_8B:1;
		unsigned char S_8I:1;
		unsigned char S_2D:1;
		unsigned char S_8L:1;
		unsigned char S_8H:1;
		unsigned char S_8A:1;
	//////// COM2 - Buf1 ///////////		
		unsigned char S_9D:1;
		unsigned char S_9N:1;
		unsigned char S_9J:1;
		unsigned char S_9G:1;
		unsigned char S_FD:1;
		unsigned char S_9K:1;
		unsigned char S_9E:1;
		unsigned char S_9F:1;	

	//////// COM2 - Buf2 ///////////		
		unsigned char S_COL:1;
		unsigned char S_9C:1;
		unsigned char S_9B:1;
		unsigned char S_9I:1;
		unsigned char S_NONE6:1;
		unsigned char S_9L:1;
		unsigned char S_9H:1;
		unsigned char S_9A:1;
	//////// COM2 - Buf3 ///////////		
		unsigned char S_10D:1;
		unsigned char S_10N:1;
		unsigned char S_10J:1;
		unsigned char S_10G:1;
		unsigned char S_NONE7:1;
		unsigned char S_10K:1;
		unsigned char S_10E:1;
		unsigned char S_10F:1;
	//////// COM2 - Buf4 ///////////		
		unsigned char S_RPT:1;
		unsigned char S_10C:1;
		unsigned char S_10B:1;
		unsigned char S_10I:1;
		unsigned char S_INT:1;
		unsigned char S_10L:1;
		unsigned char S_10H:1;
		unsigned char S_10A:1;
	//////// COM2 - Buf5 ///////////		
		unsigned char S_11D:1;
		unsigned char S_11N:1;
		unsigned char S_11J:1;
		unsigned char S_11G:1;
		unsigned char S_NONE8:1;
		unsigned char S_11K:1;
		unsigned char S_11E:1;
		unsigned char S_11F:1;
	//////// COM2 - Buf6 ///////////	
		unsigned char S_NONE9:4;
		unsigned char S_RDM:1;
		unsigned char S_11L:1;
		unsigned char S_11H:1;
		unsigned char S_11A:1;
	//////// COM2 - Buf7 ///////////
		unsigned char S_DT2:2;
		unsigned char S_Dummy4:6;	
	//////// COM3 - Buf0 ///////////	
		unsigned char S_NONE10:1;
		unsigned char S_12K:1;
		unsigned char S_12E:1;
		unsigned char S_12F:1;	
		unsigned char S_P:1;
		unsigned char S_11C:1;
		unsigned char S_11B:1;
		unsigned char S_11I:1;
	//////// COM2 - Buf1 ///////////		
		unsigned char S_LOUD:1;
		unsigned char S_12L:1;
		unsigned char S_12H:1;
		unsigned char S_12A:1;
		unsigned char S_12D:1;
		unsigned char S_12N:1;
		unsigned char S_12J:1;
		unsigned char S_12G:1;	

	//////// COM2 - Buf2 ///////////		
		unsigned char S_NONE11:1;
		unsigned char S_13K:1;
		unsigned char S_13E:1;
		unsigned char S_13F:1;
		unsigned char S_NONE12:1;
		unsigned char S_12C:1;
		unsigned char S_12B:1;
		unsigned char S_12I:1;
	//////// COM2 - Buf3 ///////////		
		unsigned char S_EQ:1;
		unsigned char S_13L:1;
		unsigned char S_13H:1;
		unsigned char S_13A:1;
		unsigned char S_13D:1;
		unsigned char S_13N:1;
		unsigned char S_13J:1;
		unsigned char S_13G:1;
	//////// COM2 - Buf4 ///////////		
		unsigned char S_NONE13:5;
		unsigned char S_13C:1;
		unsigned char S_13B:1;
		unsigned char S_13I:1;
	//////// COM2 - Buf5 ///////////		
		unsigned char S_NONE14:8;
	//////// COM2 - Buf6 ///////////		
		unsigned char S_NONE15:8;
	//////// COM2 - Buf7 ///////////
		unsigned char S_DT3:2;
		unsigned char S_Dummy6:6;	
	}bit;
	struct{
		unsigned char ucBuf[PT6524_DATA_SIZE];
	}Byte;
	struct{
		unsigned char ucCom0[PT6524_DATA_SIZE/4];
		unsigned char ucCom1[PT6524_DATA_SIZE/4];
		unsigned char ucCom2[PT6524_DATA_SIZE/4];
		unsigned char ucCom3[PT6524_DATA_SIZE/4];
	}ComData;
}PT6524_Bit;
#endif

void PT6524_BufferClear(void)
{
	memset(&PT6524_Bit.ComData.ucCom0[0], 0x00, PT6524_DATA_SIZE/4 - 1);
	memset(&PT6524_Bit.ComData.ucCom1[0], 0x00, PT6524_DATA_SIZE/4 - 1);
	memset(&PT6524_Bit.ComData.ucCom2[0], 0x00, PT6524_DATA_SIZE/4 - 1);
	memset(&PT6524_Bit.ComData.ucCom3[0], 0x00, PT6524_DATA_SIZE/4 - 1);
}

void PT6524_Initialize(void)
{
///////////////////////////// Serial 2 : PT6524  /////////////////////////////////
	u2mr = 0x01;	// Serial I/O mode select bit[0,1,2] : (001) Clock synchronous serial I/O mode
	u2c0 = 0x90;	// UiBRG count source select bit [0,1] : (01) f8SIO is selected
					// Transmit register empty flag[3] : (1) No data present in transmit register(transmission completed)
					// Transfer format select bit[7] : (1) MSB First
	u2brg = 100;
	u2c1 = 0x11;
	u2smr2 = 0x00;
	u2smr3 = 0x00 | 0x02;
	u2smr4 = 0x00;
//////////////////////////////////////////////////////////////////////////////
	PO_PT6524_RST = 1;
	ucPT6524_Active = 1;
	PO_PT6524_CE = 0;
	ucPT6524_Send_Ongoing = 0;
	
	memset(&PT6524_Bit.Byte.ucBuf[0], 0x00, 32);
	
	PT6524_Bit.bit.S_DT0 = 0;
	PT6524_Bit.bit.S_DT1 = 1;
	PT6524_Bit.bit.S_DT2 = 2;
	PT6524_Bit.bit.S_DT3 = 3;
	PT6524_Bit.bit.S_P0 = 0;	// Segment/GPIO : All is Segment
	PT6524_Bit.bit.S_P1 = 0;	// Segment/GPIO : All is Segment
	PT6524_Bit.bit.S_P2 = 0;	// Segment/GPIO : All is Segment
	PT6524_Bit.bit.S_P3 = 0;	// Segment/GPIO : All is Segment
	PT6524_Bit.bit.S_DR = 0;	// BIAS DRIVE TECHNIQUR CONTROL DATA BIT : 1/3 Bias
	PT6524_Bit.bit.S_SC = 0;	// SEGMENT ON / OFF CONTROL DATA BIT : ON
	PT6524_Bit.bit.S_BU = 0;	// NORMAL / POWER SAVING MODE SELECT BIT : Normal Mode
	PT6524_Bit.bit.S_CU = 0;	// Current Drain : Normal Current Drain
}

unsigned short const usPT6524_FontData[] =
{
	0x0000,													// 0x20, space
	SEG_H | SEG_N,											// 0x21 !
	0x0000,													// 0x22 "
	0x0000,													// 0x23 #
	0x0000,													// 0x24 $
	
	0x0000,													// 0x25 %
	0x0000,													// 0x26 &
	0x0000,													// 0x27 '
	0x0000,													// 0x28 (
	0x0000,													// 0x29 )
	
	SEG_G | SEG_H | SEG_I | SEG_J | SEG_K | SEG_N | SEG_L,		// 0x2A *
	SEG_H | SEG_J | SEG_N,									// 0x2B +
	0x0000,													// 0x2C '
	SEG_J,													// 0x2D -
	0x0000,													// 0x2E .
	
	0x0000,													// 0x2F /
	SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F | SEG_G | SEG_L,// 0x30 0
	SEG_B | SEG_C ,											// 0x31 1
	SEG_A | SEG_B | SEG_J | SEG_E | SEG_D,					// 0x32 2
	SEG_A | SEG_B | SEG_C | SEG_D | SEG_J,					// 3
	
	SEG_B | SEG_C | SEG_F | SEG_J,							// 4
	SEG_A | SEG_F | SEG_J | SEG_C | SEG_D,					// 5
	SEG_F | SEG_J | SEG_E | SEG_D | SEG_C,					// 6
	SEG_A | SEG_B | SEG_C,									// 7
	SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F | SEG_J,	// 8
	
	SEG_A | SEG_B | SEG_C | SEG_D | SEG_F | SEG_J,			// 9
	0x0000,													// :
	0x0000,													// ;
	SEG_I | SEG_L,											// <
	0x0000,													// =
	
	SEG_G | SEG_K,											// >
	0x0000,													// ?
	SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_L,			// @
	SEG_A | SEG_B | SEG_C | SEG_E | SEG_F | SEG_J,			// A
	SEG_A | SEG_B | SEG_C | SEG_D | SEG_H | SEG_N | SEG_J,	// B  
	
	SEG_A | SEG_F | SEG_E | SEG_D,							// C
	SEG_A | SEG_B | SEG_C | SEG_D | SEG_H | SEG_N,			// D
	SEG_A | SEG_D | SEG_E | SEG_F | SEG_J,					// E
	SEG_A | SEG_F | SEG_E | SEG_J,							// F
	SEG_A | SEG_F | SEG_E | SEG_D | SEG_C | SEG_J,			// G
	
	SEG_B | SEG_C | SEG_F | SEG_E | SEG_J,					// H
	SEG_A | SEG_H | SEG_N | SEG_D,							// I
	SEG_E | SEG_D | SEG_C | SEG_B,							// J
	SEG_F | SEG_E | SEG_I | SEG_L,							// K
	SEG_F | SEG_E | SEG_D,									// L
	
	SEG_F | SEG_E | SEG_B | SEG_C | SEG_G | SEG_I,			// M
	SEG_F | SEG_E | SEG_G | SEG_L | SEG_B | SEG_C,			// N
	SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F,			// O
	SEG_A | SEG_B | SEG_J | SEG_F | SEG_E,					// P
	SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F | SEG_L,	// Q
	
	SEG_A | SEG_B | SEG_J | SEG_F | SEG_E | SEG_L,			// R
	SEG_A | SEG_F | SEG_J | SEG_C | SEG_D,					// S
	SEG_A | SEG_H | SEG_N,									// T
	SEG_F | SEG_B | SEG_E | SEG_C | SEG_D,					// U
	SEG_F | SEG_E | SEG_K | SEG_I,							// V
	
	SEG_F | SEG_E | SEG_K | SEG_L | SEG_C | SEG_B,			// W
	SEG_G | SEG_I | SEG_K | SEG_L,							// X
	SEG_F | SEG_J | SEG_B | SEG_C | SEG_D,					// Y
	SEG_A | SEG_I | SEG_K | SEG_D,							// Z
	0x0000,													// Null
	
	0x0000,													// Null
	0x0000,													// Null
	SEG_J,													// ^
	SEG_D,													// _
	0x0000,													// `
	
	0x0000,													// a
	0x0000,													// b
	0x0000,													// c
	0x0000,													// d
	0x0000,													// e
	0x0000,													// f
	
	0x0000,													// g
	0x0000,													// h
	0x0000,													// i
	0x0000,													// j
	0x0000,													// k
	0x0000,													// l
	0x0000,													// m
	0x0000,													// n
	0x0000,													// o
	0x0000,													// p
	0x0000,													// q
	0x0000,													// r
	0x0000,													// s
	0x0000,													// t
	0x0000,													// u
	0x0000,													// v
	0x0000,													// w
	0x0000,													// x
	0x0000,													// y
	0x0000,													// z
	0x0000,													// {
	0x0000,													// |
	0x0000,													// }
	0x0000,													// ~
	0x0000,													// DEL
};

unsigned short const PT6524_GetFont(unsigned char ucData)
{
	unsigned char ucOffset;
	
	if  (ucData < 0x20)
	{
		return(0);
	}

	if  (ucData > 0x7F)
	{
		return(SEG_G | SEG_H | SEG_I | SEG_J | SEG_K | SEG_N | SEG_L);
	}
//	ucData = '1';
	ucOffset = ucData - 0x20;

	return(usPT6524_FontData[ucOffset]);
}

void PT6524_MakeSmallFont(unsigned char ucLoc, unsigned short usFont)
{
	if  (ucLoc == 0)
	{
		if  (usFont & SEG_K)
		{
			PT6524_Bit.bit.S_2K = 1;
		}
		if  (usFont & SEG_N)
		{
			PT6524_Bit.bit.S_2N = 1;
		}
		if  (usFont & SEG_L)
		{
			PT6524_Bit.bit.S_2L = 1;
		}
		if  (usFont & SEG_E)
		{
			PT6524_Bit.bit.S_2E = 1;
		}
		if  (usFont & SEG_J)
		{
			PT6524_Bit.bit.S_2J = 1;
		}
		if  (usFont & SEG_C)
		{
			PT6524_Bit.bit.S_2C = 1;
		}
		if  (usFont & SEG_F)
		{
			PT6524_Bit.bit.S_2F = 1;
		}
		if  (usFont & SEG_H)
		{
			PT6524_Bit.bit.S_2H = 1;
		}
		if  (usFont & SEG_B)
		{
			PT6524_Bit.bit.S_2B = 1;
		}
		if  (usFont & SEG_G)
		{
			PT6524_Bit.bit.S_2G = 1;
		}
		if  (usFont & SEG_A)
		{
			PT6524_Bit.bit.S_2A = 1;
		}
		if  (usFont & SEG_I)
		{
			PT6524_Bit.bit.S_2I = 1;
		}
		if  (usFont & SEG_D)
		{
			PT6524_Bit.bit.S_2D = 1;
		}
	}
	
	if  (ucLoc == 1)
	{
		if  (usFont & SEG_K)
		{
			PT6524_Bit.bit.S_3K = 1;
		}
		if  (usFont & SEG_N)
		{
			PT6524_Bit.bit.S_3N = 1;
		}
		if  (usFont & SEG_L)
		{
			PT6524_Bit.bit.S_3L = 1;
		}
		if  (usFont & SEG_E)
		{
			PT6524_Bit.bit.S_3E = 1;
		}
		if  (usFont & SEG_J)
		{
			PT6524_Bit.bit.S_3J = 1;
		}
		if  (usFont & SEG_C)
		{
			PT6524_Bit.bit.S_3C = 1;
		}
		if  (usFont & SEG_F)
		{
			PT6524_Bit.bit.S_3F = 1;
		}
		if  (usFont & SEG_H)
		{
			PT6524_Bit.bit.S_3H = 1;
		}
		if  (usFont & SEG_B)
		{
			PT6524_Bit.bit.S_3B = 1;
		}
		if  (usFont & SEG_G)
		{
			PT6524_Bit.bit.S_3G = 1;
		}
		if  (usFont & SEG_A)
		{
			PT6524_Bit.bit.S_3A = 1;
		}
		if  (usFont & SEG_I)
		{
			PT6524_Bit.bit.S_3I = 1;
		}
		if  (usFont & SEG_D)
		{
			PT6524_Bit.bit.S_3D = 1;
		}
	}
	
	if  (ucLoc == 2)
	{
		if  (usFont & SEG_K)
		{
			PT6524_Bit.bit.S_4K = 1;
		}
		if  (usFont & SEG_N)
		{
			PT6524_Bit.bit.S_4N = 1;
		}
		if  (usFont & SEG_L)
		{
			PT6524_Bit.bit.S_4L = 1;
		}
		if  (usFont & SEG_E)
		{
			PT6524_Bit.bit.S_4E = 1;
		}
		if  (usFont & SEG_J)
		{
			PT6524_Bit.bit.S_4J = 1;
		}
		if  (usFont & SEG_C)
		{
			PT6524_Bit.bit.S_4C = 1;
		}
		if  (usFont & SEG_F)
		{
			PT6524_Bit.bit.S_4F = 1;
		}
		if  (usFont & SEG_H)
		{
			PT6524_Bit.bit.S_4H = 1;
		}
		if  (usFont & SEG_B)
		{
			PT6524_Bit.bit.S_4B = 1;
		}
		if  (usFont & SEG_G)
		{
			PT6524_Bit.bit.S_4G = 1;
		}
		if  (usFont & SEG_A)
		{
			PT6524_Bit.bit.S_4A = 1;
		}
		if  (usFont & SEG_I)
		{
			PT6524_Bit.bit.S_4I = 1;
		}
		if  (usFont & SEG_D)
		{
			PT6524_Bit.bit.S_4D = 1;
		}
	}
	
}

void PT6524_MakeLargeFont(unsigned char ucLoc, unsigned short usFont)
{
	switch  (ucLoc)
	{
		case 0:
			if  (usFont & SEG_A)
			{
				PT6524_Bit.bit.S_2A = 1;
			}
			if  (usFont & SEG_B)
			{
				PT6524_Bit.bit.S_2B = 1;
			}
			if  (usFont & SEG_C)
			{
				PT6524_Bit.bit.S_2C = 1;
			}
			if  (usFont & SEG_D)
			{
				PT6524_Bit.bit.S_2D = 1;
			}
			if  (usFont & SEG_E)
			{
				PT6524_Bit.bit.S_2E = 1;
			}
			if  (usFont & SEG_F)
			{
				PT6524_Bit.bit.S_2F = 1;
			}
			if  (usFont & SEG_G)
			{
				PT6524_Bit.bit.S_2G = 1;
			}
			if  (usFont & SEG_H)
			{
				PT6524_Bit.bit.S_2H = 1;
			}
			if  (usFont & SEG_I)
			{
				PT6524_Bit.bit.S_2I = 1;
			}
			if  (usFont & SEG_J)
			{
				PT6524_Bit.bit.S_2J = 1;
			}
			if  (usFont & SEG_K)
			{
				PT6524_Bit.bit.S_2K = 1;
			}
			if  (usFont & SEG_N)
			{
				PT6524_Bit.bit.S_2N = 1;
			}
			if  (usFont & SEG_L)
			{
				PT6524_Bit.bit.S_2L = 1;
			}
			break;
		case 1:
			if  (usFont & SEG_A)
			{
				PT6524_Bit.bit.S_3A = 1;
			}
			if  (usFont & SEG_B)
			{
				PT6524_Bit.bit.S_3B = 1;
			}
			if  (usFont & SEG_C)
			{
				PT6524_Bit.bit.S_3C = 1;
			}
			if  (usFont & SEG_D)
			{
				PT6524_Bit.bit.S_3D = 1;
			}
			if  (usFont & SEG_E)
			{
				PT6524_Bit.bit.S_3E = 1;
			}
			if  (usFont & SEG_F)
			{
				PT6524_Bit.bit.S_3F = 1;
			}
			if  (usFont & SEG_G)
			{
				PT6524_Bit.bit.S_3G = 1;
			}
			if  (usFont & SEG_H)
			{
				PT6524_Bit.bit.S_3H = 1;
			}
			if  (usFont & SEG_I)
			{
				PT6524_Bit.bit.S_3I = 1;
			}
			if  (usFont & SEG_J)
			{
				PT6524_Bit.bit.S_3J = 1;
			}
			if  (usFont & SEG_K)
			{
				PT6524_Bit.bit.S_3K = 1;
			}
			if  (usFont & SEG_N)
			{
				PT6524_Bit.bit.S_3N = 1;
			}
			if  (usFont & SEG_L)
			{
				PT6524_Bit.bit.S_3L = 1;
			}
			break;
		case 2:
			if  (usFont & SEG_A)
			{
				PT6524_Bit.bit.S_4A = 1;
			}
			if  (usFont & SEG_B)
			{
				PT6524_Bit.bit.S_4B = 1;
			}
			if  (usFont & SEG_C)
			{
				PT6524_Bit.bit.S_4C = 1;
			}
			if  (usFont & SEG_D)
			{
				PT6524_Bit.bit.S_4D = 1;
			}
			if  (usFont & SEG_E)
			{
				PT6524_Bit.bit.S_4E = 1;
			}
			if  (usFont & SEG_F)
			{
				PT6524_Bit.bit.S_4F = 1;
			}
			if  (usFont & SEG_G)
			{
				PT6524_Bit.bit.S_4G = 1;
			}
			if  (usFont & SEG_H)
			{
				PT6524_Bit.bit.S_4H = 1;
			}
			if  (usFont & SEG_I)
			{
				PT6524_Bit.bit.S_4I = 1;
			}
			if  (usFont & SEG_J)
			{
				PT6524_Bit.bit.S_4J = 1;
			}
			if  (usFont & SEG_K)
			{
				PT6524_Bit.bit.S_4K = 1;
			}
			if  (usFont & SEG_N)
			{
				PT6524_Bit.bit.S_4N = 1;
			}
			if  (usFont & SEG_L)
			{
				PT6524_Bit.bit.S_4L = 1;
			}
			break;
		case 3:
			if  (usFont & SEG_A)
			{
				PT6524_Bit.bit.S_5A = 1;
			}
			if  (usFont & SEG_B)
			{
				PT6524_Bit.bit.S_5B = 1;
			}
			if  (usFont & SEG_C)
			{
				PT6524_Bit.bit.S_5C = 1;
			}
			if  (usFont & SEG_D)
			{
				PT6524_Bit.bit.S_5D = 1;
			}
			if  (usFont & SEG_E)
			{
				PT6524_Bit.bit.S_5E = 1;
			}
			if  (usFont & SEG_F)
			{
				PT6524_Bit.bit.S_5F = 1;
			}
			if  (usFont & SEG_G)
			{
				PT6524_Bit.bit.S_5G = 1;
			}
			if  (usFont & SEG_H)
			{
				PT6524_Bit.bit.S_5H = 1;
			}
			if  (usFont & SEG_I)
			{
				PT6524_Bit.bit.S_5I = 1;
			}
			if  (usFont & SEG_J)
			{
				PT6524_Bit.bit.S_5J = 1;
			}
			if  (usFont & SEG_K)
			{
				PT6524_Bit.bit.S_5K = 1;
			}
			if  (usFont & SEG_N)
			{
				PT6524_Bit.bit.S_5N = 1;
			}
			if  (usFont & SEG_L)
			{
				PT6524_Bit.bit.S_5L = 1;
			}
			break;
		case 4:
			if  (usFont & SEG_A)
			{
				PT6524_Bit.bit.S_6A = 1;
			}
			if  (usFont & SEG_B)
			{
				PT6524_Bit.bit.S_6B = 1;
			}
			if  (usFont & SEG_C)
			{
				PT6524_Bit.bit.S_6C = 1;
			}
			if  (usFont & SEG_D)
			{
				PT6524_Bit.bit.S_6D = 1;
			}
			if  (usFont & SEG_E)
			{
				PT6524_Bit.bit.S_6E = 1;
			}
			if  (usFont & SEG_F)
			{
				PT6524_Bit.bit.S_6F = 1;
			}
			if  (usFont & SEG_G)
			{
				PT6524_Bit.bit.S_6G = 1;
			}
			if  (usFont & SEG_H)
			{
				PT6524_Bit.bit.S_6H = 1;
			}
			if  (usFont & SEG_I)
			{
				PT6524_Bit.bit.S_6I = 1;
			}
			if  (usFont & SEG_J)
			{
				PT6524_Bit.bit.S_6J = 1;
			}
			if  (usFont & SEG_K)
			{
				PT6524_Bit.bit.S_6K = 1;
			}
			if  (usFont & SEG_N)
			{
				PT6524_Bit.bit.S_6N = 1;
			}
			if  (usFont & SEG_L)
			{
				PT6524_Bit.bit.S_6L = 1;
			}
			break;
		case 5:
			if  (usFont & SEG_A)
			{
				PT6524_Bit.bit.S_7A = 1;
			}
			if  (usFont & SEG_B)
			{
				PT6524_Bit.bit.S_7B = 1;
			}
			if  (usFont & SEG_C)
			{
				PT6524_Bit.bit.S_7C = 1;
			}
			if  (usFont & SEG_D)
			{
				PT6524_Bit.bit.S_7D = 1;
			}
			if  (usFont & SEG_E)
			{
				PT6524_Bit.bit.S_7E = 1;
			}
			if  (usFont & SEG_F)
			{
				PT6524_Bit.bit.S_7F = 1;
			}
			if  (usFont & SEG_G)
			{
				PT6524_Bit.bit.S_7G = 1;
			}
			if  (usFont & SEG_H)
			{
				PT6524_Bit.bit.S_7H = 1;
			}
			if  (usFont & SEG_I)
			{
				PT6524_Bit.bit.S_7I = 1;
			}
			if  (usFont & SEG_J)
			{
				PT6524_Bit.bit.S_7J = 1;
			}
			if  (usFont & SEG_K)
			{
				PT6524_Bit.bit.S_7K = 1;
			}
			if  (usFont & SEG_N)
			{
				PT6524_Bit.bit.S_7N = 1;
			}
			if  (usFont & SEG_L)
			{
				PT6524_Bit.bit.S_7L = 1;
			}
			break;
		case 6:
			if  (usFont & SEG_A)
			{
				PT6524_Bit.bit.S_8A = 1;
			}
			if  (usFont & SEG_B)
			{
				PT6524_Bit.bit.S_8B = 1;
			}
			if  (usFont & SEG_C)
			{
				PT6524_Bit.bit.S_8C = 1;
			}
			if  (usFont & SEG_D)
			{
				PT6524_Bit.bit.S_8D = 1;
			}
			if  (usFont & SEG_E)
			{
				PT6524_Bit.bit.S_8E = 1;
			}
			if  (usFont & SEG_F)
			{
				PT6524_Bit.bit.S_8F = 1;
			}
			if  (usFont & SEG_G)
			{
				PT6524_Bit.bit.S_8G = 1;
			}
			if  (usFont & SEG_H)
			{
				PT6524_Bit.bit.S_8H = 1;
			}
			if  (usFont & SEG_I)
			{
				PT6524_Bit.bit.S_8I = 1;
			}
			if  (usFont & SEG_J)
			{
				PT6524_Bit.bit.S_8J = 1;
			}
			if  (usFont & SEG_K)
			{
				PT6524_Bit.bit.S_8K = 1;
			}
			if  (usFont & SEG_N)
			{
				PT6524_Bit.bit.S_8N = 1;
			}
			if  (usFont & SEG_L)
			{
				PT6524_Bit.bit.S_8L = 1;
			}
			break;
		case 7:
			if  (usFont & SEG_A)
			{
				PT6524_Bit.bit.S_9A = 1;
			}
			if  (usFont & SEG_B)
			{
				PT6524_Bit.bit.S_9B = 1;
			}
			if  (usFont & SEG_C)
			{
				PT6524_Bit.bit.S_9C = 1;
			}
			if  (usFont & SEG_D)
			{
				PT6524_Bit.bit.S_9D = 1;
			}
			if  (usFont & SEG_E)
			{
				PT6524_Bit.bit.S_9E = 1;
			}
			if  (usFont & SEG_F)
			{
				PT6524_Bit.bit.S_9F = 1;
			}
			if  (usFont & SEG_G)
			{
				PT6524_Bit.bit.S_9G = 1;
			}
			if  (usFont & SEG_H)
			{
				PT6524_Bit.bit.S_9H = 1;
			}
			if  (usFont & SEG_I)
			{
				PT6524_Bit.bit.S_9I = 1;
			}
			if  (usFont & SEG_J)
			{
				PT6524_Bit.bit.S_9J = 1;
			}
			if  (usFont & SEG_K)
			{
				PT6524_Bit.bit.S_9K = 1;
			}
			if  (usFont & SEG_N)
			{
				PT6524_Bit.bit.S_9N = 1;
			}
			if  (usFont & SEG_L)
			{
				PT6524_Bit.bit.S_9L = 1;
			}
			break;
		case 8:
			if  (usFont & SEG_A)
			{
				PT6524_Bit.bit.S_10A = 1;
			}
			if  (usFont & SEG_B)
			{
				PT6524_Bit.bit.S_10B = 1;
			}
			if  (usFont & SEG_C)
			{
				PT6524_Bit.bit.S_10C = 1;
			}
			if  (usFont & SEG_D)
			{
				PT6524_Bit.bit.S_10D = 1;
			}
			if  (usFont & SEG_E)
			{
				PT6524_Bit.bit.S_10E = 1;
			}
			if  (usFont & SEG_F)
			{
				PT6524_Bit.bit.S_10F = 1;
			}
			if  (usFont & SEG_G)
			{
				PT6524_Bit.bit.S_10G = 1;
			}
			if  (usFont & SEG_H)
			{
				PT6524_Bit.bit.S_10H = 1;
			}
			if  (usFont & SEG_I)
			{
				PT6524_Bit.bit.S_10I = 1;
			}
			if  (usFont & SEG_J)
			{
				PT6524_Bit.bit.S_10J = 1;
			}
			if  (usFont & SEG_K)
			{
				PT6524_Bit.bit.S_10K = 1;
			}
			if  (usFont & SEG_N)
			{
				PT6524_Bit.bit.S_10N = 1;
			}
			if  (usFont & SEG_L)
			{
				PT6524_Bit.bit.S_10L = 1;
			}
			break;
		case 9:
			if  (usFont & SEG_A)
			{
				PT6524_Bit.bit.S_11A = 1;
			}
			if  (usFont & SEG_B)
			{
				PT6524_Bit.bit.S_11B = 1;
			}
			if  (usFont & SEG_C)
			{
				PT6524_Bit.bit.S_11C = 1;
			}
			if  (usFont & SEG_D)
			{
				PT6524_Bit.bit.S_11D = 1;
			}
			if  (usFont & SEG_E)
			{
				PT6524_Bit.bit.S_11E = 1;
			}
			if  (usFont & SEG_F)
			{
				PT6524_Bit.bit.S_11F = 1;
			}
			if  (usFont & SEG_G)
			{
				PT6524_Bit.bit.S_11G = 1;
			}
			if  (usFont & SEG_H)
			{
				PT6524_Bit.bit.S_11H = 1;
			}
			if  (usFont & SEG_I)
			{
				PT6524_Bit.bit.S_11I = 1;
			}
			if  (usFont & SEG_J)
			{
				PT6524_Bit.bit.S_11J = 1;
			}
			if  (usFont & SEG_K)
			{
				PT6524_Bit.bit.S_11K = 1;
			}
			if  (usFont & SEG_N)
			{
				PT6524_Bit.bit.S_11N = 1;
			}
			if  (usFont & SEG_L)
			{
				PT6524_Bit.bit.S_11L = 1;
			}
			break;
		case 10:
			if  (usFont & SEG_A)
			{
				PT6524_Bit.bit.S_12A = 1;
			}
			if  (usFont & SEG_B)
			{
				PT6524_Bit.bit.S_12B = 1;
			}
			if  (usFont & SEG_C)
			{
				PT6524_Bit.bit.S_12C = 1;
			}
			if  (usFont & SEG_D)
			{
				PT6524_Bit.bit.S_12D = 1;
			}
			if  (usFont & SEG_E)
			{
				PT6524_Bit.bit.S_12E = 1;
			}
			if  (usFont & SEG_F)
			{
				PT6524_Bit.bit.S_12F = 1;
			}
			if  (usFont & SEG_G)
			{
				PT6524_Bit.bit.S_12G = 1;
			}
			if  (usFont & SEG_H)
			{
				PT6524_Bit.bit.S_12H = 1;
			}
			if  (usFont & SEG_I)
			{
				PT6524_Bit.bit.S_12I = 1;
			}
			if  (usFont & SEG_J)
			{
				PT6524_Bit.bit.S_12J = 1;
			}
			if  (usFont & SEG_K)
			{
				PT6524_Bit.bit.S_12K = 1;
			}
			if  (usFont & SEG_N)
			{
				PT6524_Bit.bit.S_12N = 1;
			}
			if  (usFont & SEG_L)
			{
				PT6524_Bit.bit.S_12L = 1;
			}
			break;
		case 11:
			if  (usFont & SEG_A)
			{
				PT6524_Bit.bit.S_13A = 1;
			}
			if  (usFont & SEG_B)
			{
				PT6524_Bit.bit.S_13B = 1;
			}
			if  (usFont & SEG_C)
			{
				PT6524_Bit.bit.S_13C = 1;
			}
			if  (usFont & SEG_D)
			{
				PT6524_Bit.bit.S_13D = 1;
			}
			if  (usFont & SEG_E)
			{
				PT6524_Bit.bit.S_13E = 1;
			}
			if  (usFont & SEG_F)
			{
				PT6524_Bit.bit.S_13F = 1;
			}
			if  (usFont & SEG_G)
			{
				PT6524_Bit.bit.S_13G = 1;
			}
			if  (usFont & SEG_H)
			{
				PT6524_Bit.bit.S_13H = 1;
			}
			if  (usFont & SEG_I)
			{
				PT6524_Bit.bit.S_13I = 1;
			}
			if  (usFont & SEG_J)
			{
				PT6524_Bit.bit.S_13J = 1;
			}
			if  (usFont & SEG_K)
			{
				PT6524_Bit.bit.S_13K = 1;
			}
			if  (usFont & SEG_N)
			{
				PT6524_Bit.bit.S_13N = 1;
			}
			if  (usFont & SEG_L)
			{
				PT6524_Bit.bit.S_13L = 1;
			}
			break;
	}
}
void PT6524_Delay(unsigned char ucCnt)
{
	unsigned char i;

	for(i = 0; i < ucCnt; ++i)
	{
	}
}
void PT6524_SendCommand(unsigned char ucData)
{
	unsigned short i;

	s2tic = 0;	// Interrupt Disable
	u2tb = ucData;

	for(i = 0; i < 5000; ++i)
	{
		if  (ir_s2tic == 1)
		{
			break;
		}
	}
}
void PT6524_SendData(unsigned char ucData)
{							
	s2tic = 6;		// Interrupt enable : Level 6
	u2tb = ucData;
	ucPT6524_Cnt = 1;
}
void PT6524_SerialTX_Interrupt(void)
{
	if  ((ucPT6524_Cnt % 9) == 0)
	{
		PO_PT6524_CE = 0;
	}
	else
	{
		PO_PT6524_CE = 1;
	}	

	if  (ucPT6524_Cnt == 36)
	{
		ucPT6524_Send_Ongoing = 0;
		PO_PT6524_CE = 0;
		s2tic = 0x00;
	}
	else
	{
		u2tb = ucPT6524_Buf[ucPT6524_Cnt];
		++ucPT6524_Cnt;
	}
}

void PT6524_MakeDriverData(unsigned char *ucFontBuf, unsigned short *ucIconBuf)
{
	unsigned short usFont;

	PT6524_BufferClear();

	PT6524_MakeLargeFont(0, PT6524_GetFont(*(ucFontBuf + 0)));
	PT6524_MakeLargeFont(1, PT6524_GetFont(*(ucFontBuf + 1)));
	PT6524_MakeLargeFont(2, PT6524_GetFont(*(ucFontBuf + 2)));
	
	PT6524_MakeLargeFont(3, PT6524_GetFont(*(ucFontBuf + 3)));
	PT6524_MakeLargeFont(4, PT6524_GetFont(*(ucFontBuf + 4)));
	PT6524_MakeLargeFont(5, PT6524_GetFont(*(ucFontBuf + 5)));
	PT6524_MakeLargeFont(6, PT6524_GetFont(*(ucFontBuf + 6)));
	PT6524_MakeLargeFont(7, PT6524_GetFont(*(ucFontBuf + 7)));
	PT6524_MakeLargeFont(8, PT6524_GetFont(*(ucFontBuf + 8)));
	PT6524_MakeLargeFont(9, PT6524_GetFont(*(ucFontBuf + 9)));
	PT6524_MakeLargeFont(10, PT6524_GetFont(*(ucFontBuf + 10)));
	PT6524_MakeLargeFont(11, PT6524_GetFont(*(ucFontBuf + 11)));
	
//	PT6524_MakeLargeFont(11, 0xFFFF);

	if  (*ucIconBuf & ICON_MASK_BT)
	{
		PT6524_Bit.bit.S_BT = 1;
	}
	if  (*ucIconBuf & ICON_MASK_USB)
	{
		PT6524_Bit.bit.S_USB = 1;
	}	
	if  (*ucIconBuf & ICON_MASK_AUX)
	{
		PT6524_Bit.bit.S_AUX = 1;
	}
	if  (*ucIconBuf & ICON_MASK_MP3)
	{
		PT6524_Bit.bit.S_MP3 = 1;
	}
	if  (*ucIconBuf & ICON_MASK_WMA)
	{
		PT6524_Bit.bit.S_WMA = 1;
	}
	if  (*ucIconBuf & ICON_MASK_ST)
	{
		PT6524_Bit.bit.S_ST = 1;
	}
	if  (*ucIconBuf & ICON_MASK_FD)
	{
		PT6524_Bit.bit.S_FD = 1;
	}
	if  (*ucIconBuf & ICON_MASK_COL)
	{
		PT6524_Bit.bit.S_COL = 1;
	}
	if  (*ucIconBuf & ICON_MASK_INT)
	{
		PT6524_Bit.bit.S_INT = 1;
	}
	if  (*ucIconBuf & ICON_MASK_RPT)
	{
		PT6524_Bit.bit.S_RPT = 1;
	}
	if  (*ucIconBuf & ICON_MASK_RDM)
	{
		PT6524_Bit.bit.S_RDM = 1;
	}
	if  (*ucIconBuf & ICON_MASK_P)
	{
		PT6524_Bit.bit.S_P = 1;
	}
	if  (*ucIconBuf & ICON_MASK_LOUD)
	{
		PT6524_Bit.bit.S_LOUD = 1;
	}
	if  (*ucIconBuf & ICON_MASK_EQ)
	{
		PT6524_Bit.bit.S_EQ = 1;
	}
	
}

void PT6524_DisplayOff(void)
{
	ucPT6524_Active = 0;
	ucPT6524_Send_Ongoing = 0;
	PO_PT6524_RST = 0;
}

void PT6524_UpdateDisplay(void)
{
	unsigned char i;

	if  (ucPT6524_Active == 0)
	{
		return;
	}
	if  (ucPT6524_Send_Ongoing == 1)
	{
		return;
	}
	
	if  (ucPT6524_Update_5msecTimer != 0)
	{
		--ucPT6524_Update_5msecTimer;
		return;
	}

	PO_PT6524_CE = 0;
	memset(&ucPT6524_Buf[0], 0x00, sizeof(ucPT6524_Buf));
	ucPT6524_Buf[0] = 0x82;
	ucPT6524_Buf[9] = 0x82;
	ucPT6524_Buf[18] = 0x82;
	ucPT6524_Buf[27] = 0x82;
	memcpy(&ucPT6524_Buf[1], &PT6524_Bit.ComData.ucCom0[0], 8);
	memcpy(&ucPT6524_Buf[10], &PT6524_Bit.ComData.ucCom1[0], 8);
	memcpy(&ucPT6524_Buf[19], &PT6524_Bit.ComData.ucCom2[0], 8);
	memcpy(&ucPT6524_Buf[28], &PT6524_Bit.ComData.ucCom3[0], 8);

	//ucPT6524_Cnt = 0;
	s2tic = 0;
	ucPT6524_Send_Ongoing = 1;
	PT6524_SendData(ucPT6524_Buf[0]);
	ucPT6524_Update_5msecTimer = 50/5;	
}

